using Microsoft.Extensions.DependencyInjection;
using Winhance.WPF.Features.AdvancedTools.ViewModels;
using Winhance.WPF.Features.Common.ViewModels;
using Winhance.WPF.Features.Customize.ViewModels;
using Winhance.WPF.Features.Optimize.ViewModels;
using Winhance.WPF.Features.SoftwareApps.ViewModels;

namespace Winhance.WPF.Features.Common.Extensions.DI
{
    public static class ViewModelExtensions
    {
        public static IServiceCollection AddViewModels(this IServiceCollection services)
        {
            return services
                .AddMainViewModels()
                .AddSoftwareAppViewModels()
                .AddOptimizationViewModels()
                .AddCustomizationViewModels()
                .AddAdvancedToolsViewModels();
        }

        public static IServiceCollection AddMainViewModels(this IServiceCollection services)
        {
            services.AddSingleton<MainViewModel>();
            services.AddSingleton<MoreMenuViewModel>();
            services.AddSingleton<WinhanceSettingsViewModel>();
            services.AddTransient<LoadingWindowViewModel>();
            return services;
        }

        public static IServiceCollection AddSoftwareAppViewModels(this IServiceCollection services)
        {
            services.AddSingleton<SoftwareAppsViewModel>();
            services.AddSingleton<WindowsAppsViewModel>();
            services.AddSingleton<ExternalAppsViewModel>();
            services.AddTransient<RemovalStatusContainerViewModel>();
            services.AddTransient<RemovalStatusViewModel>();
            services.AddTransient<ExternalAppsHelpViewModel>();
            services.AddTransient<WindowsAppsHelpContentViewModel>();
            return services;
        }

        public static IServiceCollection AddOptimizationViewModels(this IServiceCollection services)
        {
            services.AddSingleton<OptimizeViewModel>();
            services.AddTransient<PowerOptimizationsViewModel>();
            services.AddTransient<PrivacyAndSecurityOptimizationsViewModel>();
            services.AddTransient<GamingandPerformanceOptimizationsViewModel>();
            services.AddTransient<NotificationOptimizationsViewModel>();
            services.AddTransient<SoundOptimizationsViewModel>();
            services.AddTransient<UpdateOptimizationsViewModel>();
            return services;
        }

        public static IServiceCollection AddCustomizationViewModels(this IServiceCollection services)
        {
            services.AddSingleton<CustomizeViewModel>();
            services.AddTransient<WindowsThemeCustomizationsViewModel>();
            services.AddTransient<StartMenuCustomizationsViewModel>();
            services.AddTransient<TaskbarCustomizationsViewModel>();
            services.AddTransient<ExplorerCustomizationsViewModel>();
            return services;
        }

        public static IServiceCollection AddAdvancedToolsViewModels(this IServiceCollection services)
        {
            services.AddSingleton<AdvancedToolsMenuViewModel>();
            services.AddSingleton<WimUtilViewModel>();
            return services;
        }

        public static IServiceCollection AddSpecializedViewModels(this IServiceCollection services)
        {
            return services;
        }
    }
}
